<template name="adminImportPrepare">
	<section class="page-container page-home page-static page-settings">
		{{#with importer}}
			{{> header sectionName=name fullpage="true"}}
			<div class="content">
				{{#unless isAdmin}}
					<p>{{_ "You_are_not_authorized_to_view_this_page"}}</p>
				{{else}}
					<div class="rocket-form">
						<fieldset>
							{{#each warnings}}
								<div class="section">
									<h1>{{_ "Warnings"}}</h1>
									<div class="section-content">
										<p style="color: #bc2031;">{{_ text}} <a href="{{href}}" target="_blank">{{href}}</a></p>
									</div>
								</div>
							{{/each}}

							{{#if isLoaded}}
								<div class="section">
									<h1>{{_ "Actions"}}</h1>
									<div class="section-content">
										<button class="button uncheck-deleted-users"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Deleted_Users"}}</span></button>
										<button class="button uncheck-archived-channels"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Archived_Channels"}}</span></button>
										<button class="button restart"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Restart_Import"}}</span></button>
										<button class="button primary start"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Start_Import"}}</span></button>
									</div>
								</div>

								{{#if users.length}}
									<div class="section">
										<h1>{{_ "Users"}}</h1>
										<div class="section-content">
											<ul>
												{{#each users}}
													{{#unless is_bot}}
														<li>
															<input type="checkbox" name="{{user_id}}" id="user_{{user_id}}" checked="checked" />
															<label for="user_{{user_id}}">{{username}} - {{email}}</label>
															{{#if is_deleted }} <em>({{_ "Deleted"}})</em>{{/if}}
															{{#if is_email_taken }} <em>({{_ "Duplicated_Email_address_will_be_ignored"}})</em>{{/if}}
														</li>
													{{/unless}}
												{{/each}}
											</ul>
										</div>
									</div>
								{{/if}}

								{{#if channels.length}}
									<div class="section">
										<h1>{{_ "Channels"}}</h1>
										<div class="section-content">
											<ul>
												{{#each channels}}
													<li>
														<input type="checkbox" name="{{channel_id}}" id="channel_{{channel_id}}" checked="checked" />
														<label for="channel_{{channel_id}}">{{name}}</label>
														{{#if is_archived}} <em>({{_ "Importer_Archived"}})</em>{{/if}}
														{{#if is_private}} <em>({{_ "Private_Group"}})</em>{{/if}}
													</li>
												{{/each}}
											</ul>
										</div>
									</div>
								{{/if}}

								<div class="section">
									<h1>{{_ "Messages"}}: {{message_count}}</h1>
								</div>
							{{else}}
								{{#if isPreparing}}
									{{> loading}}
								{{else}}
									<div class="section">
										<h1>{{_ "Importer_Source_File"}}</h1>
										<div class="section-content">
											{{ fileSizeLimitMessage }}
										</div>
										<div class="section-content">
											<input type="file" class="import-file-input">
										</div>
										<div class="section-content">
											{{_ "Importer_ExternalUrl_Description"}}
										</div>
										<div class="section-content">
											<input type="text" class="import-file-url" size=50 placeholder="{{_ "File URL" }}">
											<input type="button" value="{{_ "Import" }}" class="download-public-url">
										</div>
									</div>
								{{/if}}
							{{/if}}
						</fieldset>
					</div>
				{{/unless}}
			</div>
		{{/with}}
	</section>
</template>
